package com.lepu.app.fun.chat.bean;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Created by Administrator on 2015/12/10.
 */
public class Question {

    public String QuestionID;
    public String DoctorID;//回答者ID
    public String Question;
    public String DoctorName;
    public String Avatar;
    public String IsClosed;//是否关闭
    public String RecordCreateTime;//创建时间

    public static ArrayList<Question> parseJsonData(String dataString) {
        String result = "";
        try {
            JSONObject jsonObject = new JSONObject(dataString);
            JSONObject obj1 = (JSONObject) jsonObject.get("Result");
            JSONArray obj2 = (JSONArray) obj1.get("ListInfo");

            result = obj2.toString();
        } catch (JSONException e) {
            e.printStackTrace();
        }

        Gson gson = new Gson();
        ArrayList<Question> questions = gson.fromJson(result, new TypeToken<ArrayList<Question>>() {
        }.getType());
        return questions;
    }
}
